# #while_break_21
# # #循环输入，直到输入y n 为止：
# # while True:
# #     yn = input('continue(y/n): ')
# #     if yn in ['y', 'n']:
# #         break
# #     print('running...')
# #while_continue_22
# # 计算100以内偶数之和。
# # continue是跳过本次循环剩余部分，回到循环条件处。
# # result = 0
# # for i in range(1, 101):
# #     if i % 2 != 0:
# #         continue
# #     result += i
# #     i += 1
# # print(result)
# # astr = 'hello'
# # alist = [10, 20, 30]
# # atuple = ('bob', 'tom', 'alice')
# # adict = {'name': 'tom', 'age': '20'}
# # for ch in astr:
# #     print(ch)
# # for i in alist:
# #     print('i')
# # for name in atuple:
# #     print(name)
# # for key in adict:
# #     print('%s: %s' % (key,adict[key]))
# # range(10)
# # range(6, 10)
# # range(1, 10, 2)
# # range(10, 1 , -1)
# # sum100 = 0
# # for i in range(1, 101)
# #     sum100+= i
# #25-列表实现斐波那契数列
# #列表中先给定两个数字，后面的数字总是前两个数字之和。
# # fib = [0, 1]
# # num = '/tmp/'
# # for i in range(8):
# #     fib.append(fib[-1] + fib[-2])
# # print(fib)
# #九九乘放
# # for i in range(1, 10):
# #     for n in range(1,i + 1):
# #         print('%sX%s=%s' % (i, n, i*n),end='\t')
# #     print('')
# # for i in range(1, 10):
# #     for j in range(1, i + 1):
# #         print('%s*%s=%s' % (j, i, i * j), end=' ')
# #     print()
#
# # i=1 ->j: [1]
# # i=2 ->j: [1,2]
# # i=3 ->j: [1,2,3]
# # [10 + 5]
# # [10 + 5 for i in range(10)]
# # [10 + i for i in range(10)]
# # [10 + i for i in range(1, 11)]
# # [10 + i for i in range(1, 11) if i % 2 ==1]
# # [10 + i for i in range(1, 11) if i % 2]
# # ['192.168.1.%s' % i for i in range(1, 255)]
# #28-三局两胜的石头剪刀布
#
# from random import choice
# option  = ['石头', '剪刀', '布']
# wins    = [['石头','剪刀'],['剪刀','布'],['布','石头']]
# pwin = 0
# cwin = 0
# xuanze = '''
# (0) 石头
# (1) 剪刀
# (2) 布
# 请输入（0/1/2：其一）'''
# while pwin < 2 and cwin < 2:
#     computer = choice(option)
#     ind = int(input(xuanze))
#     player = option[ind]
#     print('你出的%s,  计算机出的%s' % (player, computer))
#
#     if player == computer:
#         print('平手')
#     elif [player, computer] in wins:
#         print('你赢了')
#         pwin += 1
#     else:
#         print('你输了')
#         cwin += 1
#right,ok!
#
#29-文件对象基础操作
import shutil
shutil.copy('/etc/passwd' ,  '/tmp')
f = open('/tmp/passwd')
data = f.read()
print(data)
f.close()
###########
>>> f = open('/tmp/passwd')
>>> data = f.read(4)
>>> f.readline()
':x:0:0:root:/root:/bin/bash\n'
>>> f.readlines()
>>> f.close()
>>> f =open('/tmp/passwd')
>>> for line in f:
...     print(line,end='')
>>> f.close()
##################
>>> f =open('/root/tupian.jpg','rb')
>>> f.read(4096)
>>> f.close()
#reght
#30-拷贝文件
>>> f1 = open('/tmp/passwd','rb')
>>> f2 = open('/tmp/ls', 'wb')
>>> data = f1.read()
>>> f2.write(data)
2192
>>> f1.close()
>>> f2.close()



























